Skip to content

Further XSS fixes in link attrs (#703)#705

Draft
Crozzers wants to merge 3 commits into
trentm:masterfrom
Crozzers:further-xss-fixes
Draft

Further XSS fixes in link attrs (#703)#705
Crozzers wants to merge 3 commits into
trentm:masterfrom
Crozzers:further-xss-fixes

Conversation

@Crozzers
Copy link
Copy Markdown
Contributor

Further fixes for #703, specifically the follow up issues raised in this comment: #703 (comment)

Issue 1:
For some reason html encoded colons function as normal colons in hrefs, so javascript:alert() is equal to javascript:alert().

Fixed this by checking for these sequences alongside colons.

Issue 2:
The safe_href regex we use allows for URL domains with ports. This was intended for links like localhost:880/abcdef but could be abused by making the JS look like a domain with a port, like so:

javascript:1/alert();
^ domain  ^ port

Issue 3:
This used some quirky markdown in a image title attr to escape the link. Fixed by hashing the title attr to prevent reprocessing, much like we do with alt=

@JorianWoltjer
Copy link
Copy Markdown

Nice work, unfortunately the fuzzer found another bypass on this new branch 😅

Input:

![](`<A B="
" onerror="alert(origin)">`)

Output:

<p><img src="code&gt;&lt;A B="
" onerror="alert(origin)"&gt;&lt;/code" alt="" /></p>

@Crozzers Crozzers marked this pull request as draft May 16, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants